//
//  PersonInfoController.swift
//  maosheng
//
//  Created by lxl on 2019/8/15.
//

import UIKit

class PersonInfoController: RootViewController {
    let personView = PersonInfoVIew()
    var userId : String?
    override func viewDidLoad() {
        super.viewDidLoad()
        addThePersonView()
        self.fd_prefersNavigationBarHidden = true

    }
    func addThePersonView() -> Void {
        view.addSubview(personView)
        personView.snp.makeConstraints { (make) in
            make.edges.equalTo(0)
        }
        
     
        personView.userId = self.userId
        personView.getUserBlog(isHeader: true)
        personView.headerView.editBtn.addTarget(self, action: #selector(jumpEditVC), for: .touchUpInside)
        let btn = PublicTools.SButtonWith(title: nil, str_img: "back", controller: self, action: #selector(backToTop))
        btn.contentHorizontalAlignment = .left
        view.addSubview(btn)
        btn.snp.makeConstraints { (make) in
            make.top.equalTo(kStatusBarHeight)
            make.left.equalTo(20)
        }
    }
    
    @objc func jumpEditVC() -> Void {
        self.jumpTheResponseVC(tagetVC: "EditPersonInfoController", title: "编辑资料")
        
    }
    override func viewWillAppear(_ animated: Bool) {
//        self.navigationController?.navigationBar.isHidden = true
        if userId != nil{
            personView.headerView.getUserInfo(userId: userId!)
        }
//        getMineInfo()
    }
    override func viewWillDisappear(_ animated: Bool) {
//        self.navigationController?.navigationBar.isHidden = false
    }
}
